﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using System.Runtime.InteropServices;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.ADF;
using ESRI.ArcGIS.SystemUI;
using ESRI.ArcGIS.Display;
using ESRI.ArcGIS.DataSourcesRaster;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Geometry;

namespace SPAS
{
    #region 苏鹏翔编写
    public partial class SymbolDesignForm : Form
    {
        public esriSimpleLineStyle inputStyle;
        public esriSimpleFillStyle fillStyle;
        public esriSimpleMarkerStyle markStyle;

        private Color _pointColor = Color.Black;
        private Color _lineColor = Color.Black;
        private Color _fillColor = Color.Black;

        public Color PointColor
        {
            get { return _pointColor; }
            set { _pointColor = value; }
        }

        public Color LineColor
        {
            get { return _lineColor; }
            set { _lineColor = value; }
        }

        public Color FillColor
        {
            get { return _fillColor; }
            set { _fillColor = value; }
        }

        
        public int lineWidth;
        int type = 0;

        public SymbolDesignForm(int i)
        {
            InitializeComponent();
            type = i;
            if (i == 1)
            {
                button2.Enabled = false;
                button3.Enabled = false;
                //Constant	Value	Description
                //esriSMSCircle	0	The marker is a circle.
                //esriSMSSquare	1	The marker is a square.
                //esriSMSCross	2	The marker is a cross.
                //esriSMSX	3	The marker is an X.
                //esriSMSDiamond	4	The marker is a
                this.comboBox1.Items.Add("circle");
                this.comboBox1.Items.Add("square");
                this.comboBox1.Items.Add("cross");
                this.comboBox1.Items.Add("X");
                this.comboBox1.Items.Add("a");
                this.comboBox1.SelectedIndex = 0;
            }
            if (i == 2)
            {
                button1.Enabled = false;
                button3.Enabled = false;
                //                          esriSLSSolid	0	The line is solid.
                //esriSLSDash	1	The line is dashed -------.
                //esriSLSDot	2	The line is dotted .......
                //esriSLSDashDot	3	The line has alternating dashes and dots _._._._.
                //esriSLSDashDotDot	4	The line has alternating dashes and double dots _.._.._.
                //esriSLSNull	5	The line is invisible.
                //esriSLSInsideFrame	6	The line will fit into it's bounding rectangle, if any.
                this.comboBox2.Items.Add("dashed");
                this.comboBox2.Items.Add("dotted");
                this.comboBox2.Items.Add("dashes dots");
                this.comboBox2.Items.Add("dashes double dots");
                this.comboBox2.Items.Add("invisible");
                this.comboBox2.Items.Add("Solid");
                textBox1.Text = "10";
                this.comboBox2.SelectedIndex = 0;
            }
            if (i == 3)
            {
                button1.Enabled = false;
                //             esriSFSSolid	0	Solid fill.
                //esriSFSNull	1	Empty fill.
                //esriSFSHollow	1	Hollow fill (same as esriSFSNull).
                //esriSFSHorizontal	2	Horizontal hatch fill ------.
                //esriSFSVertical	3	Vertical hatch fill ||||||.
                //esriSFSForwardDiagonal	4	45-degree downward, left-to-right hatch fill \\\.
                //esriSFSBackwardDiagonal	5	45-degree upward, left-to-right hatch fill //////.
                //esriSFSCross	6	Horizontal and vertical crosshatch ++++++.
                //esriSFSDiagonalCross	7	45-degree crosshatch xxxxxx.
                this.comboBox3.Items.Add("Solid");
                this.comboBox3.Items.Add("Empty");
                this.comboBox3.Items.Add("Hollow ");
                this.comboBox3.Items.Add("Horizontal");
                this.comboBox3.Items.Add("Vertical");
                this.comboBox3.Items.Add("45-degree downward");
                textBox1.Text = "10";
                this.comboBox3.SelectedIndex = 0;
                this.comboBox2.Items.Add("dashed");
                this.comboBox2.Items.Add("dotted");
                this.comboBox2.Items.Add("dashes dots");
                this.comboBox2.Items.Add("dashes double dots");
                this.comboBox2.Items.Add("invisible");
                this.comboBox2.Items.Add("Solid");
                textBox1.Text = "10";
                this.comboBox2.SelectedIndex = 0;

            }

        }

        private void symbolDesign_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            colorDialog1.ShowDialog();
            _pointColor = colorDialog1.Color;//点颜色
        }

        private void button4_Click(object sender, EventArgs e)
        {
            this.Close();
            if (type == 1)
            {
                int chioce = comboBox1.SelectedIndex;
                switch (chioce)
                {
                    case 0: markStyle = esriSimpleMarkerStyle.esriSMSCircle; break;
                    case 1: markStyle = esriSimpleMarkerStyle.esriSMSSquare; break;
                    case 2: markStyle = esriSimpleMarkerStyle.esriSMSCross; break;
                    case 3: markStyle = esriSimpleMarkerStyle.esriSMSX; break;
                    case 4: markStyle = esriSimpleMarkerStyle.esriSMSDiamond; break;

                    default: break;
                }
            }
            if (type == 2)//线形状选取
            {
                int chioce = comboBox2.SelectedIndex;
                switch (chioce)
                {
                    case 0: inputStyle = esriSimpleLineStyle.esriSLSDash; break;
                    case 1: inputStyle = esriSimpleLineStyle.esriSLSDot; break;
                    case 2: inputStyle = esriSimpleLineStyle.esriSLSDashDot; break;
                    case 3: inputStyle = esriSimpleLineStyle.esriSLSDashDotDot; break;
                    case 4: inputStyle = esriSimpleLineStyle.esriSLSNull; break;
                    case 5: inputStyle = esriSimpleLineStyle.esriSLSSolid; break;
                    default: break;
                }
                lineWidth = Convert.ToInt16(textBox1.Text);
            }
            if (type == 3)//面形状选取
            {
                int chioce3 = comboBox3.SelectedIndex;
                switch (chioce3)
                {
                    case 0: fillStyle = esriSimpleFillStyle.esriSFSSolid; break;
                    case 1: fillStyle = esriSimpleFillStyle.esriSFSNull; break;
                    case 2: fillStyle = esriSimpleFillStyle.esriSFSHollow; break;
                    case 3: fillStyle = esriSimpleFillStyle.esriSFSHorizontal; break;
                    case 4: fillStyle = esriSimpleFillStyle.esriSFSVertical; break;
                    case 5: fillStyle = esriSimpleFillStyle.esriSFSForwardDiagonal; break;
                    default: break;
                }
                int chioce2 = comboBox2.SelectedIndex;
                switch (chioce2)
                {
                    case 0: inputStyle = esriSimpleLineStyle.esriSLSDash; break;
                    case 1: inputStyle = esriSimpleLineStyle.esriSLSDot; break;
                    case 2: inputStyle = esriSimpleLineStyle.esriSLSDashDot; break;
                    case 3: inputStyle = esriSimpleLineStyle.esriSLSDashDotDot; break;
                    case 4: inputStyle = esriSimpleLineStyle.esriSLSNull; break;
                    case 5: inputStyle = esriSimpleLineStyle.esriSLSSolid; break;
                    default: break;
                }
                lineWidth = Convert.ToInt16(textBox1.Text);
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            colorDialog1.ShowDialog();
            _lineColor = colorDialog1.Color;//线颜色
        }

        private void button3_Click(object sender, EventArgs e)
        {
            colorDialog1.ShowDialog();
            _fillColor = colorDialog1.Color;//填充颜色
        }
    }
    #endregion
}

